using System;
using UnityEngine;

[Serializable]
public class calibrate : MonoBehaviour
{
	public GUISkin skin;

	public AudioClip clip;

	public GameObject tut;

	public autocalibrateonoff acof;

	public GameObject shareobj;

	public GameObject consentObj;

	private float originalWidth;

	private float originalHeight;

	public Vector2 scale;

	public calibrate()
	{
		originalWidth = 640f;
		originalHeight = 380f;
	}

	public void CheckRes()
	{
		if (Screen.width > 640)
		{
			scale.x = ((float)Screen.width + 0f) / originalWidth;
			scale.y = ((float)Screen.height + 0f) / originalHeight;
		}
		else
		{
			scale.x = 1f;
			scale.y = 1f;
		}
		if (Screen.width > 1020)
		{
			scale.x = 1024f / originalWidth;
			scale.y = 800f / originalHeight;
		}
	}

	public void OnGUI()
	{
		GUI.skin = skin;
		if (GUI.Button(new Rect((float)Screen.width / 1.1f - 80f * scale.x, Screen.height / 4 - 45, 148f * scale.x, 28f * scale.y), "Help/Info"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			tut.active = true;
			GUITouchScrollJS gUITouchScrollJS = tut.GetComponent("GUITouchScrollJS") as GUITouchScrollJS;
			gUITouchScrollJS.show = 1;
			enabled = false;
			acof.enabled = false;
		}
		if (GUI.Button(new Rect((float)Screen.width / 1.1f - 80f * scale.x, (float)(Screen.height / 4) + 5f * scale.y, 148f * scale.x, 28f * scale.y), "Ad Preference"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			UnityEngine.Object.Instantiate(consentObj);
		}
		if (GUI.Button(new Rect((float)Screen.width / 1.1f - 80f * scale.x, (float)(Screen.height / 4) + 65f * scale.y, 148f * scale.x, 28f * scale.y), "Web Page"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			Application.OpenURL("https://miksumortti.com/");
		}
		if (GUI.Button(new Rect((float)Screen.width / 1.1f - 80f * scale.x, (float)(Screen.height / 4) + 95f * scale.y, 148f * scale.x, 28f * scale.y), "Google+"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			Application.OpenURL("https://plus.google.com/113126465110131891986");
		}
	}

	public void Main()
	{
		InvokeRepeating("CheckRes", 0f, 0.5f);
	}
}
